/**

   chunksrv.h
   ==========

   Chunk server header

**/


#ifndef CHUNKSRV_H
#define CHUNKSRV_H


/**

   Includes
   --------

   - stdint.h   : uintX_t

**/


#include <stdint.h>


/**

   Forward declaration
   -------------------

   To avoid "dc.h" inclusion loop 

**/

struct dc;

/**

   Constant: CHUNKSRV_IP_LEN
   -------------------------

   IP address presentation length

**/

#define CHUNKSRV_IP_LEN      16


/**

   Structure: struct chunksrv
   --------------------------

   Members are:
   - ip    : IP address
   - port  : Service port
   - avail : Available space
   - dc    : Datacenter

**/


struct chunksrv
{
  char ip[CHUNKSRV_IP_LEN];
  uint16_t port;
  uint64_t avail;
  struct dc* dc;
};


/**

   Prototypes
   ----------

**/


struct chunksrv* chunksrv_create(char* ip, uint16_t port, uint64_t avail);
void chunksrv_delete(struct chunksrv* cs);
int chunksrv_compare(struct chunksrv* cs1, struct chunksrv* cs2);

#endif
